package com.wctj.api.base.enums;

/**
 * @author: lzg
 * @description:
 */
public enum ApiCode {
    /**
     * 成功
     */
    OK(200, "SUCCESS"),
    ADAPAY(PayPlatformEnums.HUIFU_ADAPAY.getCode(), PayPlatformEnums.HUIFU_ADAPAY.getMsg()),
    CMB(PayPlatformEnums.CMB_PAY.getCode(), PayPlatformEnums.CMB_PAY.getMsg()),
    SERVER_ERROR(100001, "服务器内部错误"),
    SERVICE_HANDLE_FAIL(100003, "业务处理失败"),
    PUSH_FAIL(100004, "推送失败"),
    PUSH_EXCEPTION(100005, "推送发生异常"),
    CREATE_AUTH_FAIL(100006, "生成签名失败"),
    SERVER_RESPONSE_BODY_NULL(100007, "服务器响应为空"),
    INTERNAL_SERVER_ERROR(10300, "服务器处理失败"),
    PUSH_FAIL_PARTIAL(100008, "部分推送失败"),
    AUTH_IS_NULL(100009, "签名未设置"),
    AUTH_NOT_MATCH(100010, "签名不匹配"),
    PLUGIN_BEAN_REGISTER_DUPLICATION(101, "插件注册，beanName重复，请检查配置"),
    PLUGIN_BEAN_REGISTER_EXCEPTION(102, "插件注册失败"),
    INVALID_PARAMETER(10100, "参数丢失或者参数不合法"),
    INVALID_PARAMETER_CHECK(10101, "参数解析失败，原因：存在与接口文档不匹配的参数，请按接口文档检查入参"),

    HUIFU_INIT_FAIL(40100, "Adapay支付初始化失敗"),
    HUIFU_PAYMENT_ORDER_FAIL(40101, "Adapay支付订单生成失敗"),
    HUIFU_CALLBACK_ANALYSIS_FAIL(40102, "Adapay支付回调参数进行签名验证失败"),
    HUIFU_PAYMENT_ORDER_INFO_FAIL(40101, "获取Adapay支付订单详情失敗"),

    PAY_ORDER_NOT_EXIST_FAIL(50100, "支付订单不存在"),
    PAY_PLATFORM_NOT_EXIST_FAIL(50101, "操作平台未匹配到"),
    PAY_CHANNEL_NOT_EXIST_FAIL(50102, "支付渠道未匹配到"),
    PAY_MODEL_NOT_EXIST_FAIL(50103, "支付模式未匹配到"),
    PAY_CALLBACK_PARAM_ERROR(50104, "获取回调参数异常"),
    PAY_CHANNEL_OPEN_ID_NOT_EXIST_FAIL(50105, "支付渠道配置信息缺失"),
    PAY_ORDER_NOT_EXIST(50106, "Adapay支付回调，支付订单未找到"),
    PAY_EVENT_TYPE_NOT_EXIST_FAIL(50107, "支付事件类型未匹配到"),
    PAY_WITHDRAWAL_TYPE_NOT_EXIST_FAIL(50108, "提现模式未匹配到"),
    PAY_WITHDRAWAL_ORDER_FAIL(50109, "招行提现订单生成失败"),
    PAY_CMB_ORDER_NOT_EXIST(50110, "招行支付回调，支付订单未找到"),
    PAY_CMB_BACK_MSG_ERROR(50111, "招行支付回调消息处理失败"),
    PAY_CMB_ORDER_HANDLE_MSG_NOT_EXIST(50112, "招行支付回调，消息解析失败"),
    PAY_SINGLETRANSFER_ORDER_FAIL(50113, "招行单笔支付转账失败"),
    PAY_BATCHTRANSFER_ORDER_FAIL(50114, "招行批量支付转账转账失败"),
    PAY_AFFILIATED_BANK_NOT_SUPPORT_SERVICES(50150, "所属银行暂不支持服务"),
    HTTP_REQUEST_FAIL(60100, "HttpClient请求失败"),

    PAY_MESSAGE_ORDER_NOT_EXIST(50108, "Adapay消息回调，支付订单未找到"),


    HUIFU_USER_PERSON_CREATE_FAIL(70100, "Adapay创建实名用户对象失敗"),
    HUIFU_USER_PERSON_QUERY_FAIL(70101, "Adapay查询用户对象失敗"),
    HUIFU_USER_PERSON_LIST_FAIL(70102, "Adapay查询用户列表对象失敗"),

    HUIFU_USER_CORP_CREATE_FAIL(70103, "Adapay创建企业用户对象失敗"),

    PAY_CONFIG_INFO_NOT_EXISTS_FAIL(80100, "支付开发平台配置信息不存在"),



    COMMON_CHECK_FAIL(90000, "操作失败"),

    AUTH_CREATE_FAIL(100100, "权限添加失败"),
    AUTH_FIND_FAIL(100101, "权限信息不存在"),
    AUTH_DELETE_FAIL(100102, "权限删除失败"),
    AUTH_UPDATE_FAIL(100103, "权限修改失败"),

    ROLE_CREATE_FAIL(100200, "角色添加失败"),
    ROLE_FIND_FAIL(100201, "角色信息不存在"),
    ROLE_DELETE_FAIL(100202, "角色删除失败"),
    ROLE_UPDATE_FAIL(100203, "角色修改失败"),



    OPERATION_ERROR(100102,"操作失败"),


    CAPTCHA_ERROR(200100,"验证码失败"),

    LOGIN_SUCCESS(200000,"登陆成功"),

    LOGIN_ERROR(200100,"登陆失败"),

    NO_VALIDATION_TOKEN(300100,"Token失效"),
    VALIDATION_FAILED(300101,"认证失败"),

    INIT_KEY_ERROR(-1,"初始化秘钥失败"),

    FORBIDDEN(400300, "没有相关权限"),
    UNAUTHORIZED(400100, "暂未登录或token已经过期"),

    VALIDATION_TOKEN_EXPIRED(400101, "登录信息已过期或已注销,请重新登录"),

    ;

    private Integer code;
    private String msg;
    ApiCode(int code, String message) {
        this.code = code;
        this.msg = message;
    }
    public Integer getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }

    public static ApiCode of(int code) {
        for (ApiCode apiCode : ApiCode.values()) {
            if (apiCode.getCode() == code) {
                return apiCode;
            }
        }
        return null;
    }
}

